<template>
	<!-- 发货单 -->
	<view class="work-container">

		<uni-list>
			<uni-list-item v-for="(item, index) in list" :key="item.vbillcode" link @click="onClick(item)">
				<view slot="body">
					<text class="title-text">
						单号：{{ item.vbillcode }}，发货：{{ formateDate(item.dsenddate) }}
					</text>
					<br>
					<text class="multiline-text">
						<!--{{ item.detailList && item.detailList.length
							? item.detailList.map(detail => `产品：${detail.name} [数量：${detail.nastnum}]`).join('；')
							: '' }} -->
					  客户：{{item.cordercustid}}；出库数：{{item.ntotalastnum}}；
					</text>
				</view>
			</uni-list-item>
		</uni-list>
	</view>
</template>

<script>
	import {
		g2list
	} from "@/api/pro_selling/get_list.js"
	import {
		parseTime
	} from "@/utils/ruoyi.js"
	export default {
		data() {
			return {
				list: []
			}
		},
		methods: {
			async getCWlist() {
				//获取5车间-发货单
				const ppw = await g2list(1,100,5);
				this.list = ppw.data.list;
				// console.log(ppw)
			},
			formateDate(ttt){
				return parseTime(ttt).slice(2, 10);
			},
			onClick(item) {
				// uni.setStorageSync('currentDetail', item);
				console.log("item.id")
				console.log(item.id)
				// console.log(uni.getStorageSync('currentDetail'))
				// 等数据存储后再跳转
				uni.navigateTo({
					url: '/pages/pro_selling/detail?id='+item.id
				});
			}
		},
		mounted() {
			this.getCWlist();
		}
	}
</script>

<style lang="scss">
	.title-text {
		font-size: 28rpx;
		white-space: normal;
		/* 允许换行 */
		word-wrap: break-word;
		/* 允许长单词或 URL 换行 */
		/* 如果父容器有固定宽度，确保宽度生效 */
	}

	.multiline-text {
		font-size: 24rpx;
		color: #777;
		white-space: normal;
		/* 允许换行 */
		word-wrap: break-word;
		/* 允许长单词或 URL 换行 */
		/* 如果父容器有固定宽度，确保宽度生效 */
	}
</style>